﻿using System;

namespace Microsoft.Xna.Framework
{
    /// <summary>
    /// Snapshot of the game timing state expressed in values that can be used by variable-step (real time) or fixed-step (game time) games.
    /// </summary>
    public class GameTime
	{
		#region Properties
		/// <summary>
        /// The amount of elapsed real time (wall clock) since the last frame.
        /// </summary>
		public TimeSpan ElapsedGameTime { get; internal set; }

        /// <summary>
        /// The amount of game time since the start of the game.
        /// </summary>
		public TimeSpan TotalGameTime { get; internal set; }

        /// <summary>
        /// Gets a value indicating that the game loop is taking longer than its TargetElapsedTime. In this case, the game loop can be considered to be running too slowly and should do something to "catch up."
        /// </summary>
		public bool IsRunningSlowly { get; internal set; }
		#endregion

		#region Constructor
		/// <summary>
		/// Creates a new instance of GameTime.
		/// </summary>
		public GameTime()
		{
		}

        /// <summary>
        /// Creates a new instance of GameTime.
        /// </summary>
        /// <param name="totalGameTime">The amount of game time since the start of the game.</param>
        /// <param name="elapsedGameTime">The amount of elapsed game time since the last update.</param>
        public GameTime(TimeSpan totalGameTime, TimeSpan elapsedGameTime)
        {
            this.TotalGameTime = totalGameTime;
            this.ElapsedGameTime = elapsedGameTime;
        }
        /// <summary>
        /// Creates a new instance of GameTime.
        /// </summary>
        /// <param name="totalGameTime">The amount of game time since the start of the game.</param>
        /// <param name="elapsedGameTime">The amount of elapsed game time since the last update.</param>
        /// <param name="isRunningSlowly">Whether the game is running multiple updates this frame.</param>
        public GameTime(TimeSpan totalGameTime, TimeSpan elapsedGameTime, bool isRunningSlowly)
        {
            this.TotalGameTime = totalGameTime;
            this.ElapsedGameTime = elapsedGameTime;
            this.IsRunningSlowly = isRunningSlowly;
		}
		#endregion
	}
}
